Skip to content

runtime: programmable sample positions only for multisampled targets, so 1x depth images stay plain (RT-SAMPLE-LOCATIONS-MSAA-ONLY) - #2649

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
DadaCap:fix/sample-locations-msaa-only
Nov 29, 2026

Conversation

@DadaCap

@DadaCap DadaCap commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Claimed in the coordination issue as: RT-SAMPLE-LOCATIONS-MSAA-ONLY (claim)

What and why

#778 (D3D-SAMPLE-POSITIONS) fills the Vulkan sample-locations grids for every sample count from 1 upwards. The device reports sample locations for 1 sample, so every single-sample depth-stencil image is then created with VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT, and each of its layout transitions carries a VkSampleLocationsInfoEXT. D3D12 only has programmable sample positions for multisampled targets, so this touches images the feature never needed.

Since #778 reached main, the Vulkan runtime loses the device in the world phase on an RTX 5080: a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned VK_ERROR_DEVICE_LOST, 100 to 230 s into every run.

This change keeps 1 sample out of the grids (SamplePositions::programmable_count), so a 1x depth image is created and transitioned exactly as before #778. The tier-2 condition is now checked on the multisampled framebuffer counts. #778 required a grid for every count, 1x included, so without this the device would drop to tier 1 and #778's d3d12_sample_grid_reset test would be skipped. MSAA images keep #778's programmable positions, and the reported tier stays the same.

How the cause was found: a bisect of the 26 runtime pull requests between a main that ran 600 s without a loss (c22a0a732) and one that lost the device (4364a4fa6). The runtime alone reproduces it, with shaders from the good translator. The last good point and the first bad point differ only by #778 on the runtime side.

The mechanism (why the flag and the barrier info on 1x depth images fault on NVIDIA, likely together with the title's aliased placed depth memory) is read in code, not measured: the runs had no driver fault report (LEONIDA_DEVICE_FAULT=2, NVIDIA diagnostics config off).

Tested

  • Unit: command_list_test with the new checks. With only the test change, main does not build it, because programmable_count does not exist there. With this change it passes.
  • d3d12: replay programmable sample positions (D3D-SAMPLE-POSITIONS) #778's own GPU tests on an RTX 5080: d3d12_msaa_draw, d3d12_custom_samples and d3d12_sample_grid_reset pass. d3d12_sample_grid_reset (tier 2) still runs.
  • ctest (540 tests, no XMA decoder, -j 20):
    • main: 2 failures, windows_crash_monitor and xbox_present.
    • With this change: the same 2, plus d3d12_queue_wait_timeout (timeout) and d3d12_mesh under the parallel load. Both pass when run alone, 2 of 2, on main and on this change.
  • Link: gta6rt links without the XMA decoder, and its imports are identical to main (30 DLLs). WS2_32 is already imported on main and is not added here.
  • In game (Vulkan runtime gta6rt, cold 300 s runs, one run each):
Build Device loss
main 7bbc1d2 lost at ~218 s
main 7bbc1d2 + this change none in 300 s
main 4364a4f lost at ~102 s (another run: ~111-230 s)
main 4364a4f + an earlier one-line version (grids from 2) none in 300 s
bisect point with #778 on top lost at ~213 s; + the one-line version: none in 300 s

GPUs tested: NVIDIA GeForce RTX 5080 16 GB, driver 621.24, Windows 11

AI-assisted: yes (Claude Code, for DadaCap)

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U

…(RT-SAMPLE-LOCATIONS-MSAA-ONLY)

ProjectLeonida#778 filled the sample-locations grids from 1 sample upwards, so every 1x depth-stencil image was created
sample-locations compatible and carried sample locations through its transitions. D3D12 only has programmable
sample positions for multisampled targets; since ProjectLeonida#778 the world phase loses the device on an RTX 5080. Keep 1 sample
out (SamplePositions::programmable_count): 1x depth images are plain again, MSAA keeps the feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U
@aslan2142
aslan2142 merged commit 32b9f4a into ProjectLeonida:main Nov 29, 2026
7 of 11 checks passed
@merzleckeier

Copy link
Copy Markdown
Contributor

Independent synthetic A/B of the merged change. A was 060c47160 (first parent of the merge), B was 32b9f4a3e. I added the same 1x D32 clear and transitions to the 4x draw fixture in both builds, plus the same logging of the created depth-image flag and transition pNext. Win64 clang-cl 23.1.5 Release (/MD) under Wine 11.22 on CachyOS. RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV Mesa 26.3.1-arch3.5).

  • MEASURED, 1x depth. With programmable positions enabled, A set VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT and attached sample locations to all five observed transitions between defined layouts per run. B cleared the create flag and emitted no sample-location pNext in those same transitions. This held in 3/3 custom and 3/3 grid runs per GPU per arm.
  • MEASURED, 4x depth. The same programmable runs retained the 4x create flag, sample-location pNext and reported tier 2 in both builds. All 24 programmable runs matched the 4,096 resolved pixels. The standard-position control also passed once per GPU per arm and had no sample-location flag or pNext.

This exercises the synthetic Vulkan depth and MSAA paths under Wine. AI-assisted with OpenAI Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants